# Copyright 2017-2020 Authors of Cilium
# SPDX-License-Identifier: Apache-2.0
#
DEFAULT_OUT := connectivity-check.yaml
HOSTPORT_OUT := connectivity-check-hostport.yaml
SINGLE_OUT := connectivity-check-single-node.yaml

SRC := $(wildcard *.yaml)
HOSTPORT_SRC := $(filter-out $(DEFAULT_OUT) $(HOSTPORT_OUT) $(SINGLE_OUT), $(SRC))
DEFAULT_SRC := $(filter-out $(wildcard *-hostport.yaml),$(HOSTPORT_SRC))
SINGLE_SRC := $(filter-out $(wildcard *-multi-node*.yaml),$(DEFAULT_SRC))


all: $(DEFAULT_OUT) $(HOSTPORT_OUT) $(SINGLE_OUT)

$(DEFAULT_OUT): $(DEFAULT_SRC)
	@echo '# Automatically generated by Makefile. DO NOT EDIT' > $(DEFAULT_OUT)
	for FILE in $(DEFAULT_SRC); do \
		cat $$FILE >> $(DEFAULT_OUT); \
		echo "---" >> $(DEFAULT_OUT); \
	done

$(HOSTPORT_OUT): $(HOSTPORT_SRC)
	@echo '# Automatically generated by Makefile. DO NOT EDIT' > $(HOSTPORT_OUT)
	for FILE in $(HOSTPORT_SRC); do \
		cat $$FILE >> $(HOSTPORT_OUT); \
		echo "---" >> $(HOSTPORT_OUT); \
	done

$(SINGLE_OUT): $(SINGLE_SRC)
	@echo '# Automatically generated by Makefile. DO NOT EDIT' > $(SINGLE_OUT)
	for FILE in $(SINGLE_SRC); do \
		cat $$FILE >> $(SINGLE_OUT); \
		echo "---" >> $(SINGLE_OUT); \
	done
